<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showTime.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	     
	
  </head>
  
  <body>
   剩余时间：<div id="expireTime"></div>
   
   <script type="text/javascript">
		var expire = 2412169;
		var expireTime = function(expires){
			if(expires > 0){
				var second = expires;
			}else{
				var second = "0 分";
				return second;
			}
			var day = hour = min = "";
			if(second>86400){
				day = Math.floor(second/86400)+"天 ";
				second = second%86400;
			}
			if(second>3600){
				hour = Math.floor(second/3600)+"时 ";
				second = second%3600;
			}
			if(second>60){
				min = Math.floor(second/60)+"分 ";
				second = second%60;
			}
			second = second+"秒";
			return day+hour+min+second;
		}
		
		var timeEle = document.getElementById("expireTime");
		
		var timer = window.setInterval(function(){
			timeEle.innerHTML = expireTime(expire--);
			if(expire<0){
				clearInterval(timer);
			}
		},1000);
	</script> 
	
  </body>
</html>
